#include <bits/stdc++.h>
// 2025/03/01
// tag: 
// Author: Forever
using namespace std;

using int64 = int64_t;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vector<int> stick(4);
    cin >> stick[0] >> stick[1] >> stick[2] >> stick[3];
    sort(stick.begin(), stick.end());
    if (stick[1] + stick[2] > stick[3] || stick[0] + stick[1] > stick[2])
        cout << "TRIANGLE" << endl;
    else if (stick[0] + stick[1] == stick[2] || stick[1] + stick[2] == stick[3])
        cout << "SEGMENT" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
    return 0;
}